package com.leancloud.circle.activity;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.aries.ui.view.title.TitleBarView;
import com.leancloud.circle.R;
import com.leancloud.circle.adapter.AttentionAdapter;
import com.leancloud.circle.manage.CirclePathManage;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;

import tech.com.commoncore.base.BaseTitleActivity;

@Route(path = CirclePathManage.CIRCLE_FANS)
public class FansActivity extends BaseTitleActivity {
    private SmartRefreshLayout smartRefresh;
    private RecyclerView recyclerView;
    private AttentionAdapter attentionAdapter;

    @Override
    public void setTitleBar(TitleBarView titleBar) {
        titleBar.setTitleMainText("粉丝");
    }

    @Override
    public int getContentLayout() {
        return R.layout.activity_fans;
    }

    @Override
    public void initView(Bundle savedInstanceState) {
        smartRefresh = findViewById(R.id.smart_refresh_layout);
        recyclerView = findViewById(R.id.fens_recycler);

        attentionAdapter = new AttentionAdapter(R.layout.circle_layout_attention_item);
        recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
        recyclerView.setAdapter(attentionAdapter);

        smartRefresh.setOnRefreshListener(new OnRefreshListener() {
            @Override
            public void onRefresh(RefreshLayout refreshLayout) {
                requestData();
            }
        });

//        if (attentions == null || attentions.isEmpty()) {
//            smartRefresh.autoRefresh();
//        }
    }

    private void requestData() {

    }

    private void updateView() {
//        if (attentions == null || attentions.isEmpty()) {
//            ToastUtil.show("还没有粉丝哦");
//            return;
//        }
//        attentionAdapter.replaceData(attentions);
//        attentionAdapter.notifyDataSetChanged();
    }
}
